import 'package:flutter/material.dart';

class BottomSheetUI extends StatefulWidget {
  // 传入参数
  const BottomSheetUI({
    Key? key,
    this.title = '标题',
    this.titleStyle,
    required this.sheetList,
  }) : super(key: key,);
  final String title;
  final TextStyle? titleStyle;
  final List<Widget> sheetList;


  @override
  State<StatefulWidget> createState() => BottomSheetUIState();

}

class BottomSheetUIState extends State<BottomSheetUI> {


  @override
  Widget build(BuildContext context) {
    var ew = MediaQuery.of(context).size.width * 0.01;
    return Container(
        height: (widget.sheetList.length > 4 ) ? (ew * 90) : ew * (widget.sheetList.length * 18 + 18),
        padding: EdgeInsets.fromLTRB(ew * 5, ew * 3, ew * 5, ew * 5),
        // 内部控件圆角
        decoration: const BoxDecoration(
            borderRadius: BorderRadius.only(topLeft: Radius.circular(10),topRight:
            Radius.circular(10)),
            color: Colors.white
        ),
        child: ListView(
          children: [
            Container(
                width: MediaQuery.of(context).size.width * 0.9,
                padding: EdgeInsets.fromLTRB(ew * 3, ew * 3, ew * 3, ew * 3),
                decoration: const BoxDecoration( border:  Border(bottom:BorderSide(width: 1,color: Color(0xffe5e5e5)) ), ),
                child: Center( child: Text(widget.title,style: widget.titleStyle ?? TextStyle(color: Colors.black26,fontSize: ew * 4,),))
            ),
            Column( children: widget.sheetList, )
          ],
        )
    );
  }


}